using UnityEngine;

namespace Brick
{
	public class Ball : MonoBehaviour
	{
		public float ForceSize = 360f;

		private Rigidbody2D _rigidbody2D;

		public bool _startMove;

		private void Start()
		{
			_rigidbody2D = GetComponent<Rigidbody2D>();
		}

		private void Update()
		{
			if (Input.GetMouseButtonDown(0))
			{
				_startMove = true;
			}
			if (_startMove)
			{
				Vector3 a = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
				Vector2 v = a - base.transform.position;
				UnityEngine.Debug.DrawRay(base.transform.position, v, Color.red, 1f);
			}
			if (Input.GetMouseButtonUp(0))
			{
				_startMove = false;
				Vector3 vector = Camera.main.ScreenToWorldPoint(UnityEngine.Input.mousePosition);
				UnityEngine.Debug.LogFormat("鼠标点击坐标:{0}", vector);
				UnityEngine.Debug.LogFormat("当前坐标:{0}", base.transform.position);
				Vector2 vector2 = vector - base.transform.position;
				UnityEngine.Debug.Log(vector2);
				_rigidbody2D.AddForce(vector2 * ForceSize);
			}
		}

		private void OnCollisionEnter2D(Collision2D col)
		{
		}

		private void OnCollisionExit2D(Collision2D c)
		{
		}

		private void OnCollisionStay2D(Collision2D c)
		{
		}

		private void OnTriggerEnter2D(Collider2D c)
		{
			UnityEngine.Debug.Log("Trigger...");
		}
	}
}

